<%@ page import="com.chg.mymvc.entity.Item" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2020/7/8
  Time: 21:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <link href="css/main.css" rel="stylesheet">
    <script>
        var updateFuction;   //定义一全局变量
        updateFuction=function update(id,perm) {
            console.log(id+"1111111"+perm)
            if (id != null) {
                $("#updateNewId").val(id);
                $("#updatename").val(perm);
            }
        }

        function  abc(str) {
            if(confirm("确认删除吗")){
                window.location.href="deleteitem?itemId="+str;
            }else {
                return false;
            }

        }

    </script>
</head>
<body>
<!-- 栏目管理 -->
<div class="AccountManagement_c" id="ColumnManagement_c">
    <h3>栏目管理
        <div class="amcl fr">
            <input type="text" placeholder="用户名" class="fl" name="">
            <div class="search fl"><img src="<%=request.getContextPath()%>/images/search.png"></div>
        </div>
    </h3>
    <div class="AM_ct text_center">
        <div class="AM_ct_in">
            <div class="add_btn df_btn fl" id="add_column_btn">添加</div>

        </div>
    </div>

    <div class="list">
        <ul class="list_h">
            <li class="b20"><label><input type="checkbox" name=""><span>序号</span></label></li>
            <li class="b20"><label>栏目名称</label></li>
            <li class="b20"><label>设置</label></li>
        </ul>
        <div class="list_b_c">
            <%
                List<Item> list = (List<Item>) request.getAttribute("ilist");
                if(list.size()<0){
            %>
            <ul class="list_null">
                <li class="text_center">未添加栏目！</li>
            </ul>
            <%  }  else{%>

            <%
                for(Item item:list){
            %>
            <ul class="list_b">
                <li class="b20"><label><span><%=item.getSequence()%></span></label></li>
                <li class="b20"><label><%=item.getPerm()%></label></li>

                <li class="b20" style="text-align: center;">
                    <div>
                        <button class="edit_btn df_btn edit_column_btn fl edit_Account_btn"  id="edit_column_btn"
                                onclick="updateFuction(<%=item.getId()%>,'<%=item.getPerm()%>')">
                            编辑
                        </button>
                        <button  class="delete_btn df_btn fl" onclick="abc(<%=item.getId()%>)">删除</button>
                    </div>
                </li>
            </ul>
            <%  }}%>


        </div>

        <div class="pull_page">
            <div class="fl pull_page_up"><a href="imanage.html?pagenum=${page.prePage}">上一页</a></div>
            <ul>


                <c:forEach begin="1" end="${page.pages}" var="pae">

                    <c:choose>
                        <c:when test="${page.pageNum == pae}">
                            <li class="on"><a href="imanage.html?pagenum=${pae}">${pae}</a></li>
                        </c:when>
                        <c:otherwise>
                            <li ><a href="imanage.html?pagenum=${pae}">${pae}</a></li>
                        </c:otherwise>
                    </c:choose>
                </c:forEach>

            </ul>
            <div class="fl pull_page_down"><a href="imanage.html?pagenum=${page.nextPage}">下一页</a></div>
        </div>


    </div>
</div>


<!-- 添加栏目 -->
<div class="add_Account dn" id="add_column">
    <form action="additem" method="post" id="item_add_form">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                添加栏目
                <span class="fr add_Account_close"><img src="images/close.png"></span>
            </div>
        </div>
        <div class="user_password user_i">
            <label>序<i>调</i>号</label> <input type="text" placeholder="输入序号" name="itemid">
        </div>
        <div class="user_name user_i">
            <label>栏目名</label> <input type="text" placeholder="输入栏目名" name="itemname">
        </div>

        <input class="add_Account_ok_btn text_center" id="add_column_ok_btn" type="submit" style="margin-left:35px;margin-top:-5px;" ></input>
    </div>
    </form>
</div>

<!-- 编辑栏目 -->
<div class="add_Account   dn" id="edit_column">
    <form action="updateitem" method="post" id="item_update_form">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                编辑栏目
                <span class="fr add_Account_close"><img src="images/close.png"></span>
            </div>
        </div>
        <div class="user_password user_i" style="border:0 none" >
            <label type="hidden" style="margin-top:-59px"></label> <input type="hidden" style="border:0 none" placeholder="输入序号" name="updateNewId" id="updateNewId" >
        </div>

        <div class="user_name user_i">
            <label>栏目名</label> <input type="text" placeholder="输入栏目名" name="updatename" id="updatename">
        </div>

        <input class="add_Account_ok_btn text_center" id="edit_column_ok_btn" type="submit" style="margin-left:35px;margin-top:-5px;" ></input>
    </div>
</div>

<!-- 删除栏目 -->
<div class="add_Account dn" id="delete_column">
    <div class="add_Account_c">
        <div class="add_Account_h">
            <div class="add_Account_h_in">
                删除栏目
                <span class="fr add_Account_close"><img src="images/close.png"></span>
            </div>
        </div>
        <div class="delete_text">确定删除“ <span>jiaopwuchu</span> ”栏目吗？</div>
        <div class="add_Account_ok_btn text_center" id="delete_column_ok_btn">确<i>皮</i>定</div>
    </div>
</div>


</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/main.js"></script>
</html>
